/*
 * @FileName: [RechargeableCardService.java]
 * 
 * @Package com.bcinfo.iccard.service
 * 
 * 
 * Copyright (c) 2011-2015 BCINFO Technology Limited Com.
 * All rights reserved.
 * 
 * This software is the confidential and proprietary
 * information of BCINFO Technology Limited Company
 * ("Confidential Information"). You shall not disclose
 * such Confidential Information and shall use it only
 * in accordance with the terms of the contract agreement
 * you entered into with RKY.
 * 
 * $Rev: 969 $
 * $LastChangedDate$
 * $LastChangedBy: xusp $
 * 
 * @category ICCARD
 * 
 * @version 1.1
 * 
 * @author $Author: xusp $
 * 
 * Change History:[Formatter: author date description] <br/>
 * 1
 * 2
 * 3
 */

package com.bcinfo.iccard.service;

import java.util.List;

import com.bcinfo.iccard.exception.CardNumIsExistException;
import com.bcinfo.iccard.exception.IccardDatabaseException;
import com.bcinfo.iccard.exception.InvalidParametersException;
import com.bcinfo.iccard.exception.RechargeableCardCancelPwdErrorException;
import com.bcinfo.iccard.exception.RechargeableCardCancelPwdNullException;
import com.bcinfo.iccard.exception.RechargeableCardIsNotExistByCardnumException;
import com.bcinfo.iccard.exception.RechargeableCardIsNotExistException;
import com.bcinfo.iccard.exception.RechargeableCardRechargeMoneyLessThanZeroException;
import com.bcinfo.iccard.exception.RechargeableCardRechargeMoneyNullException;
import com.bcinfo.iccard.exception.RechargeableCardRechargeTypeErrorException;
import com.bcinfo.iccard.exception.RechargeableCardStatusActivateException;
import com.bcinfo.iccard.exception.RechargeableCardStatusIsNotActivateException;
import com.bcinfo.iccard.exception.RechargeableCardUseNewPwdException;
import com.bcinfo.iccard.model.ExpenseRecord;
import com.bcinfo.iccard.model.RechargeableCard;
import com.bcinfo.iccard.model.RechargeableCardCancelDetail;
import com.bcinfo.iccard.model.RechargeableCardCreditDetail;
import com.bcinfo.iccard.model.RechargeableCardInfo;
import com.bcinfo.iccard.util.PaginationList;
import com.bcinfo.upp.ac.model.Operator;

/**
 * 充值卡服务 <br/>
 * <p>
 * Description:<br/>
 * <p>
 * TODO 详细描述
 * 
 * <p>
 * For Examples <br/>
 * 
 * <PRE>
 *      TODO 代码使用示例
 * </PRE>
 * <p>
 */
public interface RechargeableCardService
{

    /**
     * 
     * 充值卡入库 <br/>
     * <p>
     * Description: TODO(详细描述) <br/>
     * <p>
     * Author: tonic<br/>
     * <p>
     * Date: 2013-11-25-下午2:41:03<br/>
     * <p>
     * 
     * @param cardNum
     * @return
     * @throws IccardDatabaseException
     * @throws CardNumIsExistException
     * 
     */
    int add(RechargeableCard rechargeableCard, long opId) throws IccardDatabaseException, CardNumIsExistException;

    /**
     * 
     * 充值卡批量入库 <br/>
     * <p>
     * Description: TODO(详细描述) <br/>
     * <p>
     * Author: tonic<br/>
     * <p>
     * Date: 2013-11-25-下午2:41:14<br/>
     * <p>
     * 
     * @param cardNums
     * @return
     * @throws IccardDatabaseException
     * @throws InvalidParametersException
     * 
     */
    List<String> batchAdd(List<String> cardNums, long opId) throws IccardDatabaseException, InvalidParametersException;

    /**
     * 
     * 卡记录查询<br/>
     * <p>
     * Description: TODO(详细描述) <br/>
     * <p>
     * Author: tonic<br/>
     * <p>
     * Date: 2013-11-25-下午2:41:18<br/>
     * <p>
     * 
     * @param status
     * @param pageSize
     * @param pageNo
     * @return
     * @throws IccardDatabaseException
     * @throws InvalidParametersException
     * 
     */
    PaginationList<RechargeableCardInfo> find(String cardNum, int status, int pageSize, int pageNo)
            throws IccardDatabaseException, InvalidParametersException;

    /**
     * 
     * 一句话描述 <br/>
     * <p>
     * Description: TODO(详细描述) <br/>
     * <p>
     * Author: tonic<br/>
     * <p>
     * Date: 2013-12-2-下午1:33:01<br/>
     * <p>
     * 
     * @param cardNum
     * @param status
     * @return
     * @throws IccardDatabaseException
     * @throws InvalidParametersException
     * 
     */
    List<RechargeableCard> findInList(String cardNum, int status) throws IccardDatabaseException,
            InvalidParametersException;

    /**
     * 
     * 删除入库 <br/>
     * <p>
     * Description: TODO(详细描述) <br/>
     * <p>
     * Author: tonic<br/>
     * <p>
     * Date: 2013-11-25-下午2:41:22<br/>
     * <p>
     * 
     * @param cardId
     * @return
     * @throws IccardDatabaseException
     * 
     */
    int delete(long cardId, long opId) throws IccardDatabaseException;

    /**
     * 
     * 卡出库<br/>
     * <p>
     * Description: TODO(详细描述) <br/>
     * <p>
     * Author: tonic<br/>
     * <p>
     * Date: 2013-11-25-下午2:41:26<br/>
     * <p>
     * 
     * @param cardId
     * @param opId
     * @return
     * @throws IccardDatabaseException
     * @throws RechargeableCardIsNotExistException
     * @throws InvalidParametersException
     * 
     */
    int outbound(RechargeableCard rechargeableCard, long opId, long receiverId) throws IccardDatabaseException,
            RechargeableCardIsNotExistException, InvalidParametersException;

    /**
     * 
     * 批量卡出库操作<br/>
     * <p>
     * Description: TODO(详细描述) <br/>
     * <p>
     * Author: tonic<br/>
     * <p>
     * Date: 2013-11-25-下午2:41:30<br/>
     * <p>
     * 
     * @param cardId
     * @param opId
     * @return
     * @throws IccardDatabaseException
     * @throws InvalidParametersException
     * 
     */
    int batchOutbound(long[] cardIds, long opId, long receiverId) throws IccardDatabaseException,
            InvalidParametersException;

    /**
     * 根据操作人员，卡号%，状态查询卡列表<br/>
     * <p>
     * Description: TODO(详细描述) <br/>
     * <p>
     * Author: Administrator<br/>
     * <p>
     * Date: 2013-12-11-下午03:17:05<br/>
     * <p>
     * 
     * @param userId
     * @param cardNum
     * @param status
     * @param pageSize
     * @param pageNo
     * @return
     * @throws IccardDatabaseException
     * @throws InvalidParametersException
     * 
     */
    PaginationList<RechargeableCardInfo> findByStatus(Long userId, String cardNum, Short status, int pageSize,
            int pageNo) throws IccardDatabaseException, InvalidParametersException;

    /**
     * 
     * 卡激活 <br/>
     * <p>
     * Description: TODO(详细描述) <br/>
     * <p>
     * Author: Administrator<br/>
     * <p>
     * Date: 2013-11-26-下午02:16:23<br/>
     * <p>
     * 
     * @param opId
     * @param cardNum
     * @param rechargeType
     * @param rechargeMoney
     * @param pwd
     * @return
     * @throws IccardDatabaseException
     * @throws RechargeableCardRechargeMoneyNullException
     * @throws RechargeableCardUseNewPwdException
     * @throws RechargeableCardStatusActivateException
     * @throws RechargeableCardIsNotExistByCardnumException
     * @throws RechargeableCardRechargeTypeErrorException
     * @throws UppDataBaseException
     * 
     */
    int activate(long opId, String cardNum, Short rechargeType, float rechargeMoney, String pwd)
            throws RechargeableCardIsNotExistByCardnumException, RechargeableCardStatusActivateException,
            RechargeableCardRechargeMoneyNullException, RechargeableCardUseNewPwdException, IccardDatabaseException,
            RechargeableCardRechargeTypeErrorException;

    /**
     * 
     * 卡充值 <br/>
     * <p>
     * Description: TODO(详细描述) <br/>
     * <p>
     * Author: Administrator<br/>
     * <p>
     * Date: 2013-11-26-下午02:28:45<br/>
     * <p>
     * 
     * @param opId
     * @param cardNum
     * @param rechargeType
     * @param rechargeMoney
     * @param pwd
     * @return
     * @throws IccardDatabaseException
     * @throws RechargeableCardRechargeMoneyLessThanZeroException
     * @throws RechargeableCardStatusIsNotActivateException
     * @throws RechargeableCardIsNotExistByCardnumException
     * @throws RechargeableCardUseNewPwdException
     * @throws RechargeableCardRechargeTypeErrorException
     * 
     */
    int recharge(long opId, String cardNum, Short rechargeType, float rechargeMoney, String pwd)
            throws IccardDatabaseException, RechargeableCardRechargeMoneyLessThanZeroException,
            RechargeableCardIsNotExistByCardnumException, RechargeableCardStatusIsNotActivateException,
            RechargeableCardUseNewPwdException, RechargeableCardRechargeTypeErrorException;

    /**
     * 
     * 充值明细查询 <br/>
     * <p>
     * Description: TODO(详细描述) <br/>
     * <p>
     * Author: Administrator<br/>
     * <p>
     * Date: 2013-11-26-下午02:28:53<br/>
     * <p>
     * 
     * @param userId
     * @param cardNum
     * @param beginTime
     * @param endTime
     * @param pageSize
     * @param pageNo
     * @return
     * @throws IccardDatabaseException
     * @throws InvalidParametersException
     * 
     */
    PaginationList<RechargeableCardInfo> findDetails(Long userId, String cardNum, String beginTime, String endTime,
            int pageSize, int pageNo) throws IccardDatabaseException, InvalidParametersException;

    /**
     * 
     * 卡查询 <br/>
     * <p>
     * Description: TODO(详细描述) <br/>
     * <p>
     * Author: Administrator<br/>
     * <p>
     * Date: 2013-12-2-下午04:11:21<br/>
     * <p>
     * 
     * @param cardNum
     * @param pwd
     * @return
     * @throws RechargeableCardCancelPwdNullException
     * @throws RechargeableCardCancelPwdErrorException
     * @throws RechargeableCardIsNotExistException
     * @throws IccardDatabaseException
     * 
     */
    @Deprecated
    RechargeableCardInfo canceledCardInfo(String cardNum, String pwd) throws RechargeableCardCancelPwdNullException,
            RechargeableCardCancelPwdErrorException, RechargeableCardIsNotExistException, IccardDatabaseException;

    /**
     * 
     * 卡销户 <br/>
     * <p>
     * Description: TODO(详细描述) <br/>
     * <p>
     * Author: Administrator<br/>
     * <p>
     * Date: 2013-11-26-下午02:29:35<br/>
     * <p>
     * 
     * @param info
     * @param opId
     * @return
     * @throws IccardDatabaseException
     * @throws RechargeableCardIsNotExistException
     * @throws RechargeableCardCancelPwdNullException
     * 
     */
    int cancellation(RechargeableCardInfo info, Long opId) throws IccardDatabaseException,
            RechargeableCardIsNotExistException, RechargeableCardCancelPwdNullException;

    /**
     * 
     * 销户卡每日汇总 <br/>
     * <p>
     * Description: TODO(详细描述) <br/>
     * <p>
     * Author: Administrator<br/>
     * <p>
     * Date: 2013-11-26-下午02:32:11<br/>
     * <p>
     * 
     * @param cardNum
     * @return
     * @throws IccardDatabaseException
     * @throws InvalidParametersException
     * 
     */
    PaginationList<RechargeableCardCreditDetail> findCanceledSumByDay(String beginTime, String endTime, int pageSize,
            int pageNo) throws IccardDatabaseException, InvalidParametersException;

    /**
     * 销户记录查询 <br/>
     * <p>
     * Description: TODO(详细描述) <br/>
     * <p>
     * Author: Administrator<br/>
     * <p>
     * Date: 2013-12-6-上午11:35:59<br/>
     * <p>
     * 
     * @param cardNum
     * @param userId
     * @param beginTime
     * @param endTime
     * @param pageSize
     * @param pageNo
     * @return
     * @throws IccardDatabaseException
     * @throws InvalidParametersException
     * 
     */
    PaginationList<RechargeableCardCancelDetail> findCanceledDetailsList(String cardNum, Long userId, String beginTime,
            String endTime, int pageSize, int pageNo) throws IccardDatabaseException, InvalidParametersException;

    /**
     * 
     * 卡查询<br/>
     * <p>
     * Description: TODO(详细描述) <br/>
     * <p>
     * Author: Administrator<br/>
     * <p>
     * Date: 2013-11-26-下午02:52:21<br/>
     * <p>
     * 
     * @param cardNum
     * @param pwd
     * @return
     * @throws IccardDatabaseException
     * @throws RechargeableCardCancelPwdErrorException
     * @throws RechargeableCardIsNotExistException
     * @throws RechargeableCardCancelPwdNullException
     * 
     */
    RechargeableCardInfo findByCardnum(String cardNum, String pwd) throws RechargeableCardCancelPwdNullException,
            RechargeableCardIsNotExistException, RechargeableCardCancelPwdErrorException, IccardDatabaseException;

    /**
     * 单卡消费记录<br/>
     * <p>
     * Description: TODO(详细描述) <br/>
     * <p>
     * Author: Administrator<br/>
     * <p>
     * Date: 2013-12-9-上午09:58:10<br/>
     * <p>
     * 
     * @param cardNum
     * @param merchantName
     * @param beginTime
     * @param endTime
     * @param pageSize
     * @param pageNo
     * @return
     * @throws IccardDatabaseException
     * @throws InvalidParametersException
     * 
     */
    PaginationList<ExpenseRecord> findConsumeRecords(String cardNum, String merchantName, String beginTime,
            String endTime, int pageSize, int pageNo) throws IccardDatabaseException, InvalidParametersException;

    /**
     * 单卡充值记录 <br/>
     * <p>
     * Description: TODO(详细描述) <br/>
     * <p>
     * Author: Administrator<br/>
     * <p>
     * Date: 2013-12-9-上午11:05:53<br/>
     * <p>
     * 
     * @param cardNum
     * @param rechargeType
     * @param beginTime
     * @param endTime
     * @param pageSize
     * @param pageNo
     * @return
     * @throws IccardDatabaseException
     * @throws InvalidParametersException
     * 
     */
    PaginationList<RechargeableCardInfo> findRechargeRecords(String cardNum, Short rechargeType, String beginTime,
            String endTime, int pageSize, int pageNo) throws IccardDatabaseException, InvalidParametersException;

    /**
     * 一句话描述 <br/>
     * <p>
     * Description: TODO(详细描述) <br/>
     * <p>
     * Author: tonic<br/>
     * <p>
     * Date: 2013-11-30-下午1:49:30<br/>
     * <p>
     * 
     * @param cardIds
     * @param opId
     * @return
     * @throws IccardDatabaseException
     * 
     */
    int batchDelete(long[] cardIds, long opId) throws IccardDatabaseException;

    /**
     * 一句话描述 <br/>
     * <p>
     * Description: TODO(详细描述) <br/>
     * <p>
     * Author: tonic<br/>
     * <p>
     * Date: 2013-12-2-下午4:47:42<br/>
     * <p>
     * 
     * @param roleId
     * @return
     * @throws IccardDatabaseException
     * 
     */
    List<Operator> findUserByRoleId(Long roleId) throws IccardDatabaseException;

    /**
     * 
     * 按卡号查询卡信息 <br/>
     * <p>
     * Description: TODO(详细描述) <br/>
     * <p>
     * Author: wangguangchun<br/>
     * <p>
     * Date: 2013-12-9-下午05:02:32<br/>
     * <p>
     * 
     * @param cardNum
     *            卡号
     * @return
     * @throws IccardDatabaseException
     * @throws RechargeableCardIsNotExistByCardnumException
     * 
     */
    RechargeableCard load(String cardNum) throws IccardDatabaseException;

    List<Operator> selectUserByRoleIdAndUserName(String keyword, int maxRows);

    RechargeableCard findByCardNum(String cardNum) throws IccardDatabaseException,
            RechargeableCardIsNotExistByCardnumException;

    /**
     * 查询退款总额 <br/>
     * <p>
     * Description: TODO(详细描述) <br/>
     * <p>
     * Author: Administrator<br/>
     * <p>
     * Date: 2014-1-2-上午10:32:36<br/>
     * <p>
     * 
     * @param beginTime
     * @param endTime
     * @return
     * 
     */
    float findCancelSum(String beginTime, String endTime);
}
